<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            position: absolute;
            width: 300px;
            height: 300px;
            background-color: transparent;
        }

        .box2 {
            position: relative;
            /* top: 10px; */
            width: 200px;
            height: 200px;
            background-color: red;
            overflow: auto;
        }
    </style>
    <script>
        window.onload = function () {
            let box1 = document.getElementById("box1");
            let box2 = document.getElementById("box2");
            let btn = document.getElementById("btn");
            console.log(box2.offsetLeft);
            box2.onscroll = function () {
                if (box2.scrollHeight - box2.scrollTop == box2.clientHeight) {
                    btn.disabled = false;
                }

            }
        }

    </script>
</head>

<body>
    <div class="box1" id="box1">
        <div class="box2" id="box2">
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
            TEST
        </div>
        <input type="button" value="TEST" disabled=true id="btn">
    </div>
</body>

</html>